package com.focus.xyz.other.cases;

import com.focus.xyz.core.common.listeners.TC;
import com.focus.xyz.core.common.webdriver.DriverFactory;
import com.focus.xyz.core.utils.ProcessUtil;
import com.focus.xyz.union.action.KeyWordAction;
import org.openqa.selenium.WebDriver;
import org.testng.annotations.AfterMethod;
import org.testng.annotations.BeforeMethod;
import org.testng.annotations.Parameters;
import org.testng.annotations.Test;

/**
 * Created by chenmeng on 2016/5/10.
 */

public class SSTest extends TC {

    private WebDriver driver;
    private KeyWordAction action;

    @Parameters({"nodeUrl","browser"})
    @BeforeMethod(alwaysRun = true)
    public void setUp(String nodeUrl,String browser) throws Exception {
        driver = DriverFactory.getDriver(nodeUrl).getBrowser(browser);
        super.init(driver);
        action = new KeyWordAction(driver);

    }


    @Parameters({"browser"})
    @AfterMethod(alwaysRun = true)
    public void tearDown(String browser) {
        try{
            super.quit();
            driver.quit();
        }catch (Exception e){
            ProcessUtil.closeBrowser(browser);
        }finally {

        }
    }


    @Test(priority = 1)
    public void testxyz() throws Exception{
        action.XyzLoginFront("18651809616","He11o123");
        action.XyzLogoutFront();

    }

    @Test(priority = 0)
    public void login1() throws Exception{
        action.XyzLoginFront("619857884@qq.com","He11o123");
        while (true){
            action.pause(1);
        }
    }

    @Test(enabled = false)
    public void loginUnion() throws Exception{
        action.LoginFront("cimon007","ins1234");
        action.LogoutFront();
        action.pause(2000l);
    }

    @Test(enabled = false)
    public void loginUnion1() throws Exception{
        action.LoginFront("cimon007","ins1234");
        action.pause(2000l);
    }
}
